<template>
  <div class="viewcontainer" v-if="dataset">
    <el-row class="view-header">
      <el-col :span="22">
        <hi-lquery
          :columnsTotal="3"
          v-bind="queryPanel"
          :target="dataset"
        ></hi-lquery>
      </el-col>
      <!--   <el-col :span="2" style="text-align: right">
        <el-button type="primary" @click="showAdd">添加</el-button>
      </el-col> -->
    </el-row>
    <el-row class="view-main">
      <el-table
        ref="dataTable"
        :data="dataset.data"
        height="100%"
        style="width: 100%"
        v-loading="dataset.loading"
      >
        <el-table-column type="index" width="50" />
        <el-table-column prop="FNUMBER" label="单号" width="180" />
        <el-table-column prop="FSHOPDESC" label="店铺" width="180" />
        <el-table-column prop="FGOODSAMOUNT" label="商品数量" width="180" />
        <el-table-column prop="FORDERMONEY" label="订单金额" width="180">
          <template slot-scope="scope">
            {{ formatMoney(scope.row.FORDERMONEY) }}
          </template>
        </el-table-column>
        <el-table-column prop="FRECEIVABLEMONEY" label="应收金额" width="180">
          <template slot-scope="scope">
            {{ formatMoney(scope.row.FRECEIVABLEMONEY) }}
          </template>
        </el-table-column>
        <el-table-column prop="FCOLLECTIONMONEY" label="收款金额" width="180">
          <template slot-scope="scope">
            {{ formatMoney(scope.row.FCOLLECTIONMONEY) }}
          </template>
        </el-table-column>
        <el-table-column prop="FCHANGEMONEY" label="找零金额">
          <template slot-scope="scope">
            {{ formatMoney(scope.row.FCHANGEMONEY) }}
          </template>
        </el-table-column>
        <el-table-column fixed="right" label="操作" width="100">
          <template slot-scope="scope">
            <el-button type="text" size="small" @click="showDetail(scope)">
              详情
            </el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-row>
    <el-row class="view-footer pagebar">
      <hi-pagination
        background
        :total="dataset.total"
        :target="dataset"
      ></hi-pagination>
    </el-row>
  </div>
</template>
<script>
import { HiPagination, HiLquery, utils } from "hi-ui";
import viewBase from "../../base";
import cashierListCfg from "./dataset/cashierList";
export default {
  name: "cashierList",
  extends: viewBase,
  components: { HiPagination, HiLquery },
  data() {
    let datasetCfg = Object.assign({}, cashierListCfg, {
      action: "autoAction",
    });
    return {
      //数据桥梁
      dataBridge: new Map(),
      dataset: null,
      //数据集配置
      datasetCfg: datasetCfg,

      total: 100,
      //查询面板配置
      queryPanel: {
        fields: [
          {
            element: "el-input",
            label: "单号",
            name: "FNUMBER",
          },
          {
            element: "el-input",
            label: "店铺",
            name: "FSHOPDESCID",
            element: "hi-select-grid",
            required: true,
            props: {
              selectOption: {
                loading: true,
                multiple: false,
                clearable: true,
                filterable: true,
                "allow-create": true,
                "collapse-tags": true,
              },
              lookup: {
                modelFile: "database/shop/dataset/ShopEntity.xml",
                label: "FDESC",
                filtername: "FDESC",
                // active: false,
                tableprops: {
                  // border:true,
                  hideRowBorder: true,
                  stripe: true,
                  "show-header": false,
                  //fit:false,
                  size: "mini",
                  "max-height": 400,
                },
                returnFields: {
                  FSHOPDESCID: "FNUMBER",
                  // FSHOPDESCID: "FNUMBER",
                },
                columns: [
                  {
                    name: "FDESC",
                    label: "通用名称",
                  },
                ],
              },
            },
          },
         
        ],
      },
    };
  },

  computed: {},
  watch: {},
  methods: {
    formatMoney(val) {
      return utils.number.format(val, "￥");
    },
    showDetail(data) {
      this.openByPath(
        "/sales/cashier/salesGoods",
        { id: data.row.FID },
        { title: "【" + data.row.FNUMBER + "】详情", target: "_blank" }
      );
    },
  },
  mounted() {
    this.dataset = this.createDataSet(this.datasetCfg);
    this.dataBridge.set(this.dataset, ["dataTable"]);
  },
};
</script>
<style rel="stylesheet/scss" lang="scss" scope>
</style>